﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DataLib.Accounts.Bus;


namespace Ewts.Project
{
    public partial class ProjectList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string username = "";
                int cumid = 0;
                if (Session["UserInfo"] != null && Request["cumid"]!=null)
                {
                    User curUser = new DataLib.Accounts.Bus.User();
                    curUser = (User)Session["UserInfo"];
                    username = curUser.UserName;
                    cumid = int.Parse(Request["cumid"].ToString().Trim());
                }
                else
                {
                    Response.Redirect("/accounts/login.aspx");
                }
                bindData(username,cumid);
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="username"></param>
        /// <param name="cumid"></param>
        private void bindData(string username,int cumid)
        {
            DataTable dt = new DataTable();

            dt = new DataLib.BLL.ProjectsRelation().getAddressByUserName(username, 5,cumid);
            rept.DataSource = dt;
            rept.DataBind();
        }
    }
}